<?php $this->_extends('../_layouts/default_layout'); ?>
<?php $this->_block('contents'); ?>
<link type="text/css" href="<?=Q::ini('custom_system/base_url')?>css/prettyphoto.css" rel="stylesheet" />
<script type="text/javascript" src="<?=Q::ini('custom_system/base_url')?>js/jq.prettyphoto.js"></script>
<style>.unseen_input{border:none;}</style>
<script type="text/javascript">
$(function(){
	$("a[rel^='pretty_photo']").prettyPhoto({theme:'facebook'});
	$(".datepicker").datepicker({dateFormat:'yy-mm-dd',changeMonth:true});
	$(".info").colorbox({width:"80%", height:"70%", iframe:true});
	$(".del").click(function(){
		if ( ! confirm("确定删除？"))
		{
			return false;
		}
	});
});
</script>
<fieldset><legend>查询条件</legend>
<form method="get">
<? include(Q::ini('custom_system/elements_dir') . 'searchform_element.php');?>
<table class="form_table" width="100%">
<tr>
	<th width="100">退货日期</th>
	<td>
		<input type="text" name="begin_return_time" class="datepicker" value="<?=isset($_GET['begin_return_time']) ? $_GET['begin_return_time'] : ''?>" /> to
		<input type="text" name="end_return_time" class="datepicker" value="<?=isset($_GET['end_return_time']) ? $_GET['end_return_time'] : ''?>" />
	</td>
</tr>
<tr>
	<th>网站/店铺</th>
	<td>
		<select id="shop_id" name="shop_id">
			<option value="">请选择..</option>
			<?foreach ($shop as $k => $sh):?>
			<optgroup label="<?=$k?>">
			<?foreach ($sh as $s):?>
			<option value="<?=$s['id']?>" <?if(isset($_GET['shop_id']) && $_GET['shop_id'] == $s['id']) echo "selected='selected'";?>><?=$s['name']?></option>
			<?endforeach;?>
			</optgroup>
			<?endforeach;?>
		</select>
	</td>
</tr>
<tr>
	<th>仓库</th>
	<td>
		<select name="warehouse_id">
			<option value="">请选择..</option>
			<?foreach ($warehouse as $w):?>
			<option value="<?=$w['id']?>" <?if (isset($_GET['warehouse_id']) && $_GET['warehouse_id'] == $w['id'])echo "selected='selected'"?>><?=$w['name']?></option>
			<?endforeach;?>
		</select>
	</td>
</tr>
<tr>
	<th>原订单号</th>
	<td><input type="text" name="order_number" value="<?=isset($_GET['order_number']) ? $_GET['order_number'] : ''?>" /></td>
</tr>
<tr>
	<th>买家ID</th>
	<td><input type="text" name="shop_buyer_id" value="<?=isset($_GET['shop_buyer_id']) ? $_GET['shop_buyer_id'] : ''?>" /></td>
</tr>
<tr>
	<th>退货单号</th>
	<td><input type="text" name="number" value="<?=isset($_GET['number']) ? $_GET['number'] : ''?>" /></td>
</tr>
<tr>
	<th>状态</th>
	<td>
		<?foreach (Q::ini('custom_flag/sales_return_status') as $srs):?>
		<label><input type="checkbox" name="return_status[<?=$srs['value']?>]" value="<?=$srs['value']?>" <?if (isset($_GET['return_status']) &&  array_key_exists($srs['value'], $_GET['return_status'])) echo "checked='checked'"?> /> <?=$srs['name']?></label>
		<?endforeach;?>
	</td>
</tr>
<tr>
	<th></th>
	<td><input type="submit" class="button" value="查询" /></td>
</tr>
</table>
</form>
</fieldset>
<table width="100%" class="list_table">
<tr>
	<th width="50">ID</th>
	<th width="130">退货日期</th>
	<th width="130">网站/店铺</th>
	<th width="100">原订单号</th>
	<th width="100">买家ID</th>
	<th width="80">仓库</th>
	<th width="100">退货单号</th>
	<th>退货原因</th>
	<th width="100">状态</th>
	<th width="120">操作</th>
</tr>
<?foreach ($sales_return as $sr):?>
<tr>
	<td><?=$sr['id']?></td>
	<td><?=$sr['make_time']?></td>
	<td><?=$sr['shop_name']?></td>
	<td><?=$sr['order_number']?></td>
	<td><?=$sr['shop_buyer_id']?></td>
	<td><?=$sr['warehouse_name']?></td>
	<td><a class="info" href="<?=url('Sales::Order/ReturnInfo', array('id'=>$sr['id']))?>"><?=$sr['number']?></a></td>
	<td><?=$sr['reason']?></td>
	<td><?=Helper_BSS_Normal::getIniOne('sales_return_status', 'value', $sr['status'], 'name')?></td>
	<td>
		<?if ($sr['status'] == Q::ini('custom_flag/sales_return_status/new/value')):?>
		<a href="<?=url('Sales::Order/ReturnEdit', array('id'=>$sr['id']))?>">编辑</a>
		<a class="del" href="<?=url('Sales::Order/ReturnDelete', array('id'=>$sr['id']))?>">删除</a>
		<?else:?>
		编辑 删除
		<?endif;?>
	</td>
</tr>
<?endforeach;?>
</table>
<?=$page?>
<?php $this->_endblock(); ?>